package com.yincheng.oes.business.group.model.dto;

import com.yincheng.oes.business.consist.Consists;
import org.apache.commons.lang3.StringUtils;

/**
 * @Author: yangsy
 * @Contact: 446948434@qq.com
 * @Date: 2021/8/22 20:55
 * @Version: 1.0
 * @Description: 班级学员的考试成绩信息
 */
public class UserPaperResultDTO {


    private static final String NONE_CHAR = "/";

    /**
     * 试卷名称
     */
    private String paperName;

    /**
     * 得分率
     */
    private String scoreRate = NONE_CHAR;

    /**
     * 得分率，
     */
    private Float scoreRateF;

    /**
     * 正确/总题
     */
    private String correctDivideTotal = NONE_CHAR;

    /**
     * 完成时间 yyyy年MM月DD日 HH:mm
     */
    private String finishTime = NONE_CHAR;

    /**
     * 获取单元格底色
     *
     * @return 单元格底色
     */
    public String getColor() {
        if (NONE_CHAR.equals(scoreRate) || StringUtils.isEmpty(scoreRate)) {
            return Consists.RED;
        }
        if (scoreRateF > 0.6) {
            return Consists.GREEN;
        }
        return Consists.YELLOW;
    }

    public Float getScoreRateF() {
        return scoreRateF;
    }

    public void setScoreRateF(Float scoreRateF) {
        this.scoreRateF = scoreRateF;
    }

    @Override
    public String toString() {
        return "UserPaperResultDTO{" +
                "paperName='" + paperName + '\'' +
                ", scoreRate='" + scoreRate + '\'' +
                ", correctDivideTotal='" + correctDivideTotal + '\'' +
                ", finishTime='" + finishTime + '\'' +
                '}';
    }

    public UserPaperResultDTO() {
    }

    public UserPaperResultDTO(String paperName) {
        this.paperName = paperName;
    }


    public String getPaperName() {
        return paperName;
    }

    public void setPaperName(String paperName) {
        this.paperName = paperName;
    }

    public String getScoreRate() {
        return scoreRate;
    }

    public void setScoreRate(String scoreRate) {
        this.scoreRate = scoreRate;
    }

    public String getCorrectDivideTotal() {
        return correctDivideTotal;
    }

    public void setCorrectDivideTotal(String correctDivideTotal) {
        this.correctDivideTotal = correctDivideTotal;
    }

    public String getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(String finishTime) {
        this.finishTime = finishTime;
    }
}
